# -*- coding: utf-8 -*-
import urllib
import sys, urllib2
# s https rabotaet normalno
# hotja google sna4ala dernul 4erez https a potom http
# http://bugs.python.org/issue1519816
# DataMime sites with hotels
class dmHotel:
    def __init__(self, site):
        self.site = site
    def get_site(self, url):
        url = 'https://www.booking.com'
        #url = 'http://tycho.usno.navy.mil/cgi-bin/timer.pl'
        usock = urllib2.urlopen(url)
        #data = usock.read()
        print usock.read()
    def get_site_other(self, url):    
            proxy_info = {
               'user' : 'ykoval',
               'pass' : '!@P@ssw0rd',
               'host' : "db-proxy-kf.dbdc.luxoft.com",
               'port' : 8080 # or 8080 or whatever
                  }
            #authinfo = urllib2.HTTPBasicAuthHandler()
            #authinfo.add_password('realm', 'host', 'username', 'password')
            #proxy_support = urllib2.ProxyHandler({'8080': 'http://kiev-isa-db.dbdc.luxoft.com:8080'})
            proxy_support = urllib2.ProxyHandler({"http" : \
                 "http://%(user)s:%(pass)s@%(host)s:%(port)d" % proxy_info})
            opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)                 
            urllib2.install_opener(opener)
            rr = urllib2.urlopen('http://itc.ua/articles/uchitsya_nikogda_ne_pozdno_servisy_videourokov_53374?s=66a2cf3a81dbb645ac5823decd028451').read()
            print rr
dm = dmHotel('test')
dm.get_site_other('test')
#h = httplib2.Http(".cache")
#response, content = h.request('http://tycho.usno.navy.mil/cgi-bin/timer.pl')
#html_file = content.decode("utf-8")
#print(html_file)
 